<?php
/**
 * 手机用户模型
 */
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\Traits\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;

class GpsadvUser extends Model
{

    use BaseModel; //基础模型
    use SoftDeletes; //软删除
    //数据表名称
    protected $table = 'gpsadv_users';
    //数据项名称
    protected $itemName = '手机用户';
    //批量赋值白名单
    protected $fillable = [
       'user_client_id',
       'status',
       'android_id'
    ];
    //输出隐藏字段
    protected $hidden = [
       'deleted_at'
    ];
    //日期字段
    protected $dates = [
       'created_at',
       'updated_at',
       'deleted_at'
    ];
    //字段值map
    protected $fieldsShowMaps = [
        'status'=>[
            "0"=>'注销',
            "1"=>'有效',
            "2"=>'停用'
         ]
    ];
    //字段默认值
    protected $fieldsDefault = [
        'user_client_id' => '',
        'status' => 2,
        'android_id' => ''
    ];
    //字段说明
    protected $fieldsName = [
        'id' => 'ID',
        'user_client_id' => '手机用户客户端ID',
        'status' => '状态',
        'android_id' => '安卓ID',
        'created_at' => '创建时间',
        'updated_at' => '修改时间',
        'deleted_at' => '删除时间'
    ];

//  获取某个用户未过期投放的广告
    public function advers(){
        return $this->hasMany("App\Models\GpsadvAdvers","user_id","id");
    }


}
